﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Configuration;

namespace Inovout.Cloud.DataWarehouse.Web.Utility
{
    public class ConfigurationUtility
    {
        public static string GetAppSetting(string key)
        {
            HttpContext context = HttpContext.Current;
            if (context != null)
            {
                Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
                if (config.AppSettings.Settings[key] != null)
                {
                    return config.AppSettings.Settings[key].Value;
                }
            }
            else
            {
                if (ConfigurationManager.AppSettings[key] != null)
                {
                    return ConfigurationManager.AppSettings[key].ToString();
                }
            }
            return string.Empty;
        }

    }
}